package top.itaso.app.room.entity;

import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.Ignore;
import androidx.room.Index;
import androidx.room.PrimaryKey;

import org.jetbrains.annotations.NotNull;

/**
 * @Description: 离线注册的用户信息表
 * https://blog.csdn.net/u011897062/article/details/82107709
 * @Author itsdf07
 * @E-Mail 923255742@qq.com
 * @Gitee https://gitee.com/itsdf07
 * @Date 2022/1/10
 */
@Entity(tableName = "users", indices = {@Index(value = {"_username"}, unique = true)})
//复合主键：@Entity(primaryKeys = {"uid", "displayName"})
public class UserEntity {
//    @PrimaryKey(autoGenerate = true)
//    @ColumnInfo(name = "_id")
//    private int id = 0;

    /**
     * 用户登录账号
     */
    @PrimaryKey
    @ColumnInfo(name = "_username")
    @NotNull
    private String userName;

    /**
     * 注册 uid，用于账号登录
     */
    @ColumnInfo(name = "_uid")
    @NotNull
    private String uid;

    /**
     * 用户 昵称
     */
    @ColumnInfo(name = "_display_name")
    private String displayName;

    @ColumnInfo(name = "_password")
    @NotNull
    private String password;

    /**
     * 性别
     */
    @ColumnInfo(name = "_sex")
    @NotNull
    private int sex = 1;

    /**
     * uid 状态，如 正常/已注销/已禁用 等等
     */
    @ColumnInfo(name = "_state")
    @NotNull
    private int state = 1;

    /**
     * 数据创建时间，可用于现在注册时间
     */
    @ColumnInfo(name = "_create_date")
    @NotNull
    private String createDate;//2022-01-11

    /**
     * token
     */
    @Ignore
    private String token;

    /**
     * 头像
     */
    @Ignore
    private String avatar;

    /**
     * 登录结果
     */
    @Ignore
    private int loginState = 0;

    public String getUid() {
        return uid;
    }

    public void setUid(String uid) {
        this.uid = uid;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(@NotNull String userName) {
        this.userName = userName;
    }

    public String getDisplayName() {
        return displayName;
    }

    public void setDisplayName(String displayName) {
        this.displayName = displayName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(@NotNull String password) {
        this.password = password;
    }

    public int getSex() {
        return sex;
    }

    public void setSex(int sex) {
        this.sex = sex;
    }

    public int getState() {
        return state;
    }

    public void setState(@NotNull int state) {
        this.state = state;
    }

    public String getCreateDate() {
        return createDate;
    }

    public void setCreateDate(@NotNull String createDate) {
        this.createDate = createDate;
    }

    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }

    public String getToken() {
        return token;
    }

    public void setToken(String token) {
        this.token = token;
    }

    public int getLoginState() {
        return loginState;
    }

    public void setLoginState(int loginState) {
        this.loginState = loginState;
    }
}
